In [2]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as ex
import plotly.graph_objs as go
In [3]:
df = pd.read_csv('BankChurners.csv')
In [4]:
ex.pie(df,names='Attrition_Flag',title='Proportion of churn vs not churn customers',hole=0.33)
In [5]:
display(df['Customer_Age'].skew())
sns.histplot(df.Customer_Age,kde=True)
-0.033605016317173456
Out[5]:
<AxesSubplot:xlabel='Customer_Age', ylabel='Count'>
In [7]:
display(df['Total_Revolving_Bal'].skew())
sns.histplot(df.Total_Revolving_Bal,kde=True)
-0.14883725028007228
Out[7]:
<AxesSubplot:xlabel='Total_Revolving_Bal', ylabel='Count'>
In [8]:
display(df['Total_Trans_Ct'].skew())
sns.histplot(df.Total_Trans_Ct,kde=True)
# multimodal distribution
# may have some underlying groups in our data
0.15367306849872275
Out[8]:
<AxesSubplot:xlabel='Total_Trans_Ct', ylabel='Count'>
In [9]:
sns.catplot(x="Card_Category", hue="Gender", col="Attrition_Flag",
                data=df, kind="count",
                height=4, aspect=.7)
Out[9]:
<seaborn.axisgrid.FacetGrid at 0x24ec9c68df0>
In [10]:
sns.countplot(x=df.Total_Trans_Ct,hue=df.Attrition_Flag)
Out[10]:
<AxesSubplot:xlabel='Total_Trans_Ct', ylabel='count'>
In [11]:
sns.countplot(x=df.Customer_Age,hue=df.Attrition_Flag)
Out[11]:
<AxesSubplot:xlabel='Customer_Age', ylabel='count'>